//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CDrawCallsBatch.cpp>
///	@path	~/src/graphics/batch/
///	@date	2008/04/26
///	@desc	.

#include "config/config.h"

#include "graphics/batch/CDrawCallsBatch.h"

namespace xeres {

	IMPL_IOBJECT_CLASS_DYNAMIC( CDrawCallsBatch );

	// CDrawCallsBatch
	CDrawCallsBatch::CDrawCallsBatch( void )
	{

	}
	// ~CDrawCallsBatch
	CDrawCallsBatch::~CDrawCallsBatch( void )
	{

	}
	// BeginBatch
	void CDrawCallsBatch::BeginBatch( void )
	{
		// clear previous draw calls
		m_drawCalls.clear();
	}
	// EndBatch
	void CDrawCallsBatch::EndBatch( void )
	{

	}
	// Render
	void CDrawCallsBatch::Render( RenderContext& rc )
	{
		for( size_t i = 0 , total = m_drawCalls.size() ; i < total ; ++i )
		{
			m_drawCalls[i]( rc );
		}
	}
	// AddDrawCall
	void CDrawCallsBatch::AddDrawCall( const function<void(RenderContext&)>& dc )
	{
		m_drawCalls.push_back( dc );
	}
	
} // namespace xeres
